home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / AmigaTalk / intuition / Border.st < prev    next >
Encoding:
Text File  |  2004-01-31  |  3.1 KB  |  137 lines

  1. "--------------------------------------------------"
  2. " Border Class implements control of Amiga Borders."
  3. "--------------------------------------------------"
  4.  
  5. Class Border :Glyph ! private parent !
  6. [
  7.    dispose
  8.  
  9.       <primitive 187 0 private>.
  10.       
  11.       <primitive 250 5 0 private>.
  12.       
  13.       ^ nil
  14. |
  15.    registerTo: parentObject
  16.  
  17.       " Valid parents are Windows, Screens, Requesters, & Gadgets: "
  18.  
  19.       parent <- <primitive 187 5 parentObject self>
  20. |
  21.    setStartPoint: sPoint " Set the LeftEdge & TopEdge parameters: "
  22.  
  23.       <primitive 187 3 0 (sPoint x) private>.
  24.       <primitive 187 3 1 (sPoint y) private>
  25. |
  26.    getStartPoint
  27.  
  28.       ^ <primitive 187 2 0 private> @ <primitive 187 2 1 private>
  29. |
  30.    getBorderPens
  31.  
  32.       ^ <primitive 187 2 2 private> @ <primitive 187 2 3 private>
  33. |
  34.    setBorderPens: newPensPoint
  35.  
  36.       <primitive 187 3 2 (newPensPoint x) private>.
  37.       <primitive 187 3 3 (newPensPoint y) private>
  38. |
  39.    getDrawMode
  40.  
  41.       ^ <primitive 187 2 4 private>
  42. |
  43.    setDrawMode: newDrawMode
  44.  
  45.       <primitive 187 3 4 newDrawMode private>
  46. |
  47.    getCount
  48.  
  49.       ^ <primitive 187 2 5 private>
  50. |
  51.    setCount: newCount
  52.  
  53.       <primitive 187 3 5 newCount private>
  54. |
  55.    getNextBorder
  56.  
  57.       ^ <primitive 187 2 6 private>
  58. |
  59.    setNextBorder: newBorder
  60.  
  61.       <primitive 187 3 6 newBorder private>
  62. |
  63.    setBorderPoint: thePt to: newPoint
  64.  
  65.       <primitive 187 4 thePt (newPoint x) (newPoint y) private>
  66. |
  67.    draw  " Only if parent is a Screen, Window or Requester: "
  68.  
  69.       <primitive 187 6 self>
  70. |
  71.    new: numPoints
  72.  
  73.       private <- <primitive 187 1 numPoints>.
  74.  
  75.       ^ self
  76. ]
  77.  
  78. "---------------------------------------------------------------------"
  79. " Line Class relies on Class Border to implement a lot of its methods."
  80. "---------------------------------------------------------------------"
  81.  
  82. Class Line :Border ! private !
  83. [
  84.   makeLineFrom: fPoint to: tPoint
  85.  
  86.     private <- <primitive 187 1 2>.
  87.  
  88.     super setBorderPoint: 1 to: fPoint.
  89.     super setBorderPoint: 2 to: tPoint.
  90.  
  91.     ^ self
  92. ]
  93.  
  94. "---------------------------------------------------"
  95. " Triangle Class relies on Class Border to implement"
  96. " a lot of its methods.                             "
  97. "---------------------------------------------------"
  98.  
  99. Class Triangle :Border ! private !
  100. [
  101.   makeTriangle: v1Point vert2: v2Point vert3: v3Point
  102.  
  103.     private <- <primitive 187 1 4>.
  104.  
  105.     super setBorderPoint: 1 to: v1Point.
  106.     super setBorderPoint: 2 to: v2Point.
  107.     super setBorderPoint: 3 to: v3Point.
  108.     super setBorderPoint: 4 to: v1Point.
  109.  
  110.     ^ self
  111. ]
  112.  
  113. "----------------------------------------------------"
  114. " Rectangle Class relies on Class Border to implement"
  115. " a lot of its methods.                              "
  116. "----------------------------------------------------"
  117.  
  118. Class Rectangle :Border ! private !
  119. [
  120.   makeRectangleFrom: fPoint to: tPoint ! x1 y1 x2 y2 !
  121.  
  122.     x1 <- fPoint x.
  123.     y1 <- fPoint y.
  124.     x2 <- tPoint x.
  125.     y2 <- tPoint y.
  126.  
  127.     private <- <primitive 187 1 5>.
  128.         
  129.     super setBorderPoint: 1 to: x1 @ y1.
  130.     super setBorderPoint: 2 to: x2 @ y1.
  131.     super setBorderPoint: 3 to: x2 @ y2.
  132.     super setBorderPoint: 4 to: x1 @ y2.
  133.     super setBorderPoint: 5 to: x1 @ y1.
  134.  
  135.     ^ self    
  136. ]
  137.